package com.byb.server.domain;

import io.swagger.annotations.ApiModel;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.springframework.data.elasticsearch.annotations.Document;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;

/**
 * 问题答疑
 */
@ApiModel(description = "问题答疑")
@Entity
@Table(name = "wc_question")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Document(indexName = "wcquestion")
public class WcQuestion implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(name = "q_info")
    private String qInfo;

    @Column(name = "a_info")
    private String aInfo;

    @ManyToOne
    private WcProduct wcProduct;

    // jhipster-needle-entity-add-field - Jhipster will add fields here, do not remove
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getqInfo() {
        return qInfo;
    }

    public WcQuestion qInfo(String qInfo) {
        this.qInfo = qInfo;
        return this;
    }

    public void setqInfo(String qInfo) {
        this.qInfo = qInfo;
    }

    public String getaInfo() {
        return aInfo;
    }

    public WcQuestion aInfo(String aInfo) {
        this.aInfo = aInfo;
        return this;
    }

    public void setaInfo(String aInfo) {
        this.aInfo = aInfo;
    }

    public WcProduct getWcProduct() {
        return wcProduct;
    }

    public WcQuestion wcProduct(WcProduct wcProduct) {
        this.wcProduct = wcProduct;
        return this;
    }

    public void setWcProduct(WcProduct wcProduct) {
        this.wcProduct = wcProduct;
    }
    // jhipster-needle-entity-add-getters-setters - Jhipster will add getters and setters here, do not remove

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        WcQuestion wcQuestion = (WcQuestion) o;
        if (wcQuestion.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), wcQuestion.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(getId());
    }

    @Override
    public String toString() {
        return "WcQuestion{" +
            "id=" + getId() +
            ", qInfo='" + getqInfo() + "'" +
            ", aInfo='" + getaInfo() + "'" +
            "}";
    }
}
